// import { nanoid, customAlphabet } from 'nanoid';
import UserModel from '../model/musenumUser';

export async function AddUser(uuid: string, username: string, nickname: string, phonenumber: string, token: string) {
  let data: any = { nickname, username, uuid, phonenumber, token };

  const model = await UserModel.findOne(uuid);
  if (model) {
      await UserModel.update(data, uuid);
      // UserLogs('编辑用户', JSON.stringify(data), uuid2, 0, uuid);
  } else {
      await UserModel.insert(data);
      // UserLogs('新增用户', JSON.stringify(data), model2.uuid, 0, uuid);
  }
}

export async function GetUserList(pageindex: string | undefined, platform) {
  return UserModel.getlist(Number(pageindex || 1), platform);
}

export async function DeleteUserList(id: string) {
  await UserModel.update({ status: 0 }, id);
    // UserLogs('删除用户', '', ids.join(), 1, uuid);
}
